import 'package:flutter/material.dart';
/*按钮*/
class Exam_5 extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: AppBar(
        title: Text("按钮"),
      ),
      body: Content(),
    );
  }

}

class Content extends StatelessWidget{

  void _press(){
    print("图片Button点击");
  }

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return ListView(
      children: <Widget>[
        /**1.悬浮按钮,它默认带有阴影和灰色背景。按下后，阴影会变大*/
        RaisedButton(
          child: Text("RaisedButton"),
          onPressed: (){
            print("RaisedButton");
          },
        ),
        /**2.扁平按钮，默认背景透明并不带阴影。按下后，会有背景色*/
        FlatButton(
          child: Text("FlatButton"),
          onPressed: (){
            print("FlatButton");
          },
        ),
        /**3.默认有一个边框，不带阴影且背景透明。按下后，边框颜色会变亮、同时出现背景和阴影(较弱)*/
        OutlineButton(
          child: Text("OutlineButton"),
          onPressed: (){
            print("OutlineButton");
          },
        ),
        /**4.默认有一个边框，不带阴影且背景透明。按下后，边框颜色会变亮、同时出现背景和阴影(较弱)*/
        IconButton(
          icon: Icon(Icons.thumb_up),
          onPressed: (){
            print(IconButton);
          },
        ),
        /**带图标*/
        RaisedButton.icon(onPressed: _press, icon: Icon(Icons.send ), label: Text("发送")),
        OutlineButton.icon(onPressed: _press, icon: Icon(Icons.add), label: Text("添加")),
        FlatButton.icon(onPressed: _press, icon: Icon(Icons.info), label: Text("详情")),
        /**自定义按钮*/
        RaisedButton(
          color: Colors.blue,
          highlightColor: Colors.blue[700],
          colorBrightness: Brightness.dark,
          splashColor: Colors.grey,
          child: Text("Submit"),
          shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)),
          onPressed: (){
            print("点击自定义按钮");
          },
        ),
      ],
    );
  }
}